package com.longrise.co.ui.carfiles.adapter;


import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.longrise.co.R;
import com.longrise.co.ui.home.model.BindCarInfo;
import com.ly.common.commonutils.ImageLoaderUtils;
import com.ly.common.commonutils.StringUtils;
import com.ly.common.commonutils.TimeUtil;

import java.util.List;


/**
 * Created by admin on 2017/2/4.
 */

public class BindCarInfoAdapter extends BaseQuickAdapter<BindCarInfo.ListBean> {

    private Context mContext;

    public BindCarInfoAdapter(Context context, List<BindCarInfo.ListBean> listData) {
        super(R.layout.item_car_file, listData);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, BindCarInfo.ListBean data) {

        baseViewHolder.setText(R.id.car_no,  data.getCarno())
                .setText(R.id.car_date, "认证日期：" + TimeUtil.getDateYMD(data.getCreatetime()))
                .setText(R.id.repair_count_tv, String.valueOf(data.getRepairnum()))
                .setText(R.id.evaluation_tv, String.valueOf(data.getAppraisenum()));

        ImageView imageView = baseViewHolder.getView(R.id.car_file_iv);

        if(imageView != null && !StringUtils.isEmpty(data.getCarphoto())) {
            ImageLoaderUtils.display(mContext, imageView, data.getCarphoto());
        }

    }


}
